package com.socket.clientsocket
{
	import flash.utils.ByteArray;

	/**
	 *客户端网络接口 
	 * @author liangxuhu
	 * 
	 */	
	public interface IClientSocket
	{
		/**
		 * 设置回调接口
		 * @param clientSocketHandler
		 * @return 
		 * 
		 */		
		function setClientSocketCallBack(clientSocketHandler:IClientSocketHandler):Boolean;
		/**
		 *获取回调接口 
		 * @return 
		 * 
		 */		
		function getClientSocketCallBack():IClientSocketHandler
		/**
		 *添加回调接口 
		 * @param clientSocketHandler
		 * @return 
		 * 
		 */		
		function addClientSocketHandler(clientSocketHandler:IClientSocketHandler):Boolean;
		/**
		 *删除回调接口 
		 * @param clientSocketHandler
		 * @return 
		 * 
		 */		
		function removeClientSocketHandler(clientSocketHandler:IClientSocketHandler):Boolean;
		/**
		 *删除所有回调接口 
		 * 
		 */		
		function removeAllClientSocketHandler():void;
		
		/**
		 *获取状态 
		 * @return 
		 * 
		 */		
		function get connectState():int;
		/**
		 *设置数据加密密钥 
		 * @param packetKey
		 * 
		 */		
		function set packetKey(packetKey:uint):void;
		/**
		 *连接服务器 
		 * @param serverIP
		 * @param port
		 * @return 
		 * 
		 */		
		function connect(serverIP:String,port:int):Boolean;
		/**
		 *发送函数 
		 * @param mainCmdID
		 * @param subCmdID
		 * @return 
		 * 
		 */		
		function sendCmd(mainCmdID:int,subCmdID:int):Boolean;
		/**
		 *发送函数 
		 * @param mainCmdID
		 * @param subCmdID
		 * @param data
		 * @param dataSize
		 * @return 
		 * 
		 */		
		function sendData(data:ByteArray,dataSize:int):Boolean;
		/**
		 *关闭连接 
		 * @param notify
		 * @return 
		 * 
		 */		
		function closeSocket(notify:Boolean):Boolean;
	}
}